package com.ecube.test;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author zhuweijun
 * @version 1.0.0
 * @since 2025/8/11 15:29
 */
public class JSONTestMain {

    public static void main(String[] args) {

        String JSONString = "{\"currAvg\":110.0,\"deviceCode\":\"1001100012025152\",\"dt\":\"2025-08-11 15:00:24\",\"productKey\":\"100110001\",\"voltAvg\":220.0, \"pTotal\": 24.2}";

        CurrPower t = JSON.parseObject(JSONString, CurrPower.class);
        System.out.println(t.getPTotal());
    }


    @Data
    public static class CurrPower {
        private String productKey;

        private String deviceCode;

        private String dt;

        private BigDecimal voltAvg;

        private BigDecimal currAvg;

        private BigDecimal pTotal;
    }
}
